Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Objects /
Chapter 4 - Colors and Color-Related Objects / Colors and Color-Related Objects Reference
Constants and Data Types


The Color Structure

A color value, plus a specification of the color space it belongs to, plus an optional reference to a color profile to use for color matching, constitute a color in QuickDraw GX. A color is a structure defined by the gxColor type definition:

struct gxColor{
   gxColorSpace         space;
   gxColorProfile       profile;
   union {
         struct gxCMYKColor      cmyk;
         struct gxRGBColor       rgb;
         struct gxRGBAColor      rgba;
         struct gxHSVColor       hsv;
         struct gxHLSColor       hls;
         struct gxXYZColor       xyz;
         struct gxYXYColor       yxy;
         struct gxLUVColor       luv;
         struct gxLABColor       lab;
         struct gxYIQColor       yiq;
         gxColorValue            gray;
         struct gxGrayAColor     graya;
         unsigned short          pixel16;
         unsigned long           pixel32;
         struct gxIndexedColor   indexed;
         gxColorValue            component[4];
   } element;
};
Field Description
space
The color space for this color.
profile
A reference to a color profile to be used for color matching when drawing or when converting this color to another color space. If this field is nil, the default QuickDraw GX color profile is used for matching.
element
The color value for this color.
The element field is a union that can contain any one of the following fields:

cmyk
A CMYK color value.
rgb
An RGB color value.
rgba
An alpha-channel RGB color value.
hsv
An HSV color value.
hls
An HLS color value.
xyz
An XYZ color value.
yxy
A Yxy color value.
luv
An L*u*v* color value.
lab
An L*a*b* color value.
yiq
A YIQ color value.
gray
A grayscale color value
graya
An alpha-channel grayscale color value.
pixel16
A 16-bit pixel value, in gxRGB16Space format.
pixel32
A 32-bit pixel value, in any of the 32-bit color space formats.
indexed
An indexed color value.
component
An array of 4 undefined color-component values. Useful for indexing through the color one component at a time, as when working with different transfer modes for each color component.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996